/**
 * User: muxin4ever
 * Date: Oct, 31, 2012
 * Time: 21:25
 */

package handler;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import calculation.Matrix;
import calculation.MatrixLibrary;

public class InputHandler {
	private MatrixLibrary matrixLibrary;
	private FileHandler fileHandler;

	public InputHandler(FileHandler fileHandler, MatrixLibrary matrixLibrary) {
		this.matrixLibrary = matrixLibrary;
		this.fileHandler = fileHandler;

		loadMatricesFromLibraryDirectory();

	}

	public void loadMatricesFromLibraryDirectory() {
		Map<String, Matrix> matrixList = new HashMap<String, Matrix>();

		File library = new File(fileHandler.getLibraryDirectoryPath());
		File[] fileArray = library.listFiles();

		for (File file : fileArray) {
			if (!file.isFile())
				continue;

			matrixList.put(file.getName(), null);

		}
		matrixLibrary.setMatrixList(matrixList);
	}

	public void updateOneMatrix() {

	}

}
